<!DOCTYPE html>
<html lang="zh-CN">
@include('base.head')
<body>
@include('index.base')
@if(session('__Ajax_RedirectFunc_status') == true)
    <div>
        <div class="alert alert-success alert-dismissible fade in" role="alert">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
            <h3>成功</h3>
            <p><?php echo session('__Ajax_RedirectFunc_message');?></p>
            <p><?php echo session('__Ajax_RedirectFunc_plugin');?></p>
        </div>
    </div>
@endif
@if(session('__Ajax_RedirectFunc_status') === false)
    <div >
        <div class="alert alert-danger alert-dismissible fade in" role="alert">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
            <h3>失败</h3>
            <p><?php echo session('__Ajax_RedirectFunc_message');?></p>
            <p><?php echo session('__Ajax_RedirectFunc_plugin');?></p>
        </div>
    </div>
@endif

<div class="container">
    <div class="row">
        <div class="col-md-12" >
            <div class="panel panel-default">
                <div class="panel-body" >
                    <h3>当前物品：{{$goodsInfo->goods_name}}<small class="pull-right">{{$goodsInfo->goods_buy_num}}人已购买</small></h3>
                    <hr>
                    <div class="col-md-4 well" style="text-align: center">
                        <img src="/images/{{$goodsInfo->goods_image}}" width="100%">
                    </div>
                    <div class="col-md-1"> </div>
                    <div class="col-md-7" >
                        <h4>上架日期：{{$goodsInfo->goods_time}}</h4>
                        <br>
                        <h4>商品说明：{{$goodsInfo->goods_info}}</h4>
                        <br>
                        <h4>商品售价：{{$goodsInfo->goods_price}} 元</h4>
                        <br>
                    </div>
                </div>

                <hr>
                <div class="panel-body" style="text-align: center">
                    <div class="form-inline">
                        <div class="form-group">
                            <button type="button" class="btn btn-success" data-toggle="modal" data-target="#order">购买</button>

                            <div class="modal fade" id="order" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                            <h4 class="modal-title" id="myModalLabel2">扫码支付</h4>
                                        </div>
                                        <div class="modal-body">
                                            <form action="/order_goods" method="post">
                                                <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                                <input type="hidden" name="goods_id" value="{{$goodsInfo->goods_id}}">
                                                <div>
                                                    {!! QrCode::size(200)->encoding('UTF-8')->generate("{$goodsInfo->goods_price}元") !!}
                                                </div>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="submit" class="btn btn-success">支付</button>
                                            <button type="button" class="btn btn-default" data-dismiss="modal">返回</button>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            @if(empty($check) == true)
                                <form method="post" action="/add_goods_car">
                                    <input type="hidden" name="_token" value="{{csrf_token()}}">
                                    <input type="hidden" name="shop_car_goods" value="{{$goodsInfo->goods_id}}">
                                    <button type="submit" class="btn btn-default">收藏</button>
                                </form>
                            @endif
                            @if(empty($check) == false)
                                <form method="post" action="/del_goods_car">
                                    <input type="hidden" name="_token" value="{{csrf_token()}}">
                                    <input type="hidden" name="shop_car_goods" value="{{$goodsInfo->goods_id}}">
                                    <button type="submit" class="btn btn-danger">已收藏</button>
                                </form>
                            @endif
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="col-md-12" >
                        <h4>商品评价：</h4>
                        <hr>
                        <table class="table table-responsive table-condensed table-hover table-striped">
                            <thead>
                            <tr>
                                <th>评价时间</th>
                                <th>评价内容</th>
                                <th>评价买家</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($goodsEVA as $data)
                                <tr>
                                    <td>{{$data->evaluate_time}}</td>
                                    <td>{{$data->evaluate_info}}</td>
                                    <td>{{$data->user_name}}</td>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


</body>
</html>